package com.xwj.item.controller;

import com.xwj.item.domain.Item;
import com.xwj.item.service.ItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author xwj
 * @date 2019/12/17
 */
@RestController
@RequestMapping("/item")
public class ItemController {
    @Autowired
    private ItemService itemService;

    @Value("${server.port}")
    private String servicePort;

    /**
     * 对外提供接口服务，查询商品信息
     *
     * @param id
     * @return
     */
    @GetMapping(value = "/{id}")
    public Item queryItemById(@PathVariable("id") Long id) {
        System.out.println("service port:" + servicePort);
        return itemService.queryItemById(id);
    }
}
